package com.itheima.sh.bulk.controller;

import com.itheima.sh.bulk.pojo.Result;
import com.itheima.sh.bulk.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("/good")
public class GoodController {

 @Autowired
 private SearchService searchService;

    @GetMapping("/search/{page}/{size}")
    public Result findGoodsPage(@PathVariable("page")Integer page,@PathVariable("size")Integer size,@RequestParam("keyword")String keyword,
           @RequestParam("price")String price,@RequestParam("createTime")String createTime) throws IOException {

        Result result = searchService.searchAndParse(page, size, keyword,price,createTime);
        result.setMessage("查询成功");
        result.setCode(200);
        return result;

    }
}
